import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: wangxin
 * Date: 2024-08-14
 * Time: 20:01
 */
public class Demo7 {
    public static void main(String[] args) {
        File f = new File("text3.txt");
        System.out.println(f.exists());
        try(InputStream inputStream = new FileInputStream("text3.txt")){
            byte[] buf = new byte[1024];
            int len;
            while(true){
                len = inputStream.read(buf);
                if(len == -1){
                    break;
                }
                for (int i = 0; i < len; i++) {
                    System.out.printf("%c",buf[i]);
                }
            }

        }catch(IOException e){
            e.printStackTrace();
        }
    }
}
